package com.git.bds.mr.patient.convert;

import com.git.bds.mr.patient.model.domain.PatientInfo;
import com.git.bds.mr.patient.model.dto.PatientDTO;
import com.git.bds.mr.records.model.domain.Amendments;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

/**
 * @author 成大事
 * @since 2022/9/23 18:36
 */
@Mapper
public interface PatientBizConvert {

    PatientBizConvert INSTANCE = Mappers.getMapper(PatientBizConvert.class);

    /**
     * 至患者信息
     *
     * @param patientDTO 患者dto
     * @return {@link PatientInfo}
     */
    PatientInfo toPatientInfo(PatientDTO patientDTO);

    ///**
    // * 自定义枚举转换器
    // *
    // * @param name 名称
    // * @return {@link Gender}
    // */
    //default  Gender customConvert(String name){
    //    for (Gender ge: Gender.values()){
    //        if (name.equals(ge.getValue())){
    //            return ge;
    //        }
    //    }
    //    return null;
    //}

    /**
     * 修正案
     *
     * @param doctorId  医生id
     * @param patientId 患者id
     * @param remark    评论
     * @return {@link Amendments}
     */
    @Mapping(source = "doctorId",target = "doctorId")
    @Mapping(source = "patientId",target = "patientId")
    @Mapping(source = "remark",target = "remark")
    Amendments toAmendments(Long doctorId, Long patientId, String remark);

}
